<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>客服记录</title>   
	
	
	<script type="text/javascript" src="js/jquery-easyui-1.5.4.2/jquery.min.js"></script>
	<script type="text/javascript" src="js/jquery-easyui-1.5.4.2/locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript" src="js/jquery-easyui-1.5.4.2/jquery.easyui.min.js"></script>
	<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.5.4.2/themes/icon.css"/>
	<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.5.4.2/themes/black/easyui.css"/>
	

<style type="text/css">
</style>
<title>客户服务</title>      
</head>   
<body>  
<link rel="stylesheet" type="text/css" href="css/llj/CustomerService_css.css"> 	       
<script type="text/javascript">

    function editCustomrServer(crId){
    	$("#CusSerAddLog").dialog({href2:"editCusmerMessage",title:'编辑客服记录'});
    	$("#CusSer_form_data").form('load','searchCusomerMessage?crId='+crId);  
    	$("#CusSer_deleverId").val(1); 
		$("#CusSer_custorId").val(1);  
		$("#CusSer_contId").val(1);
		$("#CusSerAddLog").dialog("open");                   
    	  
    }
    function deleteCustomrServer(crId){  
		$.messager.confirm('提示','确定要删除吗？',function(v){
			if(v){
				$.getJSON('deleteCusmerMessage',{crId:crId},function(obj){
					if(obj=='success'){                  
						alert("删除成功");     
					}else{      
						alert("删除成功");          
					}  
					$('#CusSerDagrid').datagrid('reload');         
				});            
			}
		});
	}
    
    
    
    $(function(){
    	$("#CusSer_Add").linkbutton({onClick:function(){
    		$("#CusSerAddLog").dialog({href2:"addCusomerService",title:'添加客服记录'});
    		$("#CusSer_form_data").form("clear");       
    		$("#CusSer_deleverId").val(1);  
    		$("#CusSer_custorId").val(1);  
    		$("#CusSer_contId").val(1);    
    		alert($("#CusSer_contId").text());
    		$("#CusSerAddLog").dialog("open");       
    	}});
    	
    	$("#CusSer__refresh_list_all").linkbutton({onClick:function(){
    		$('#CusSerDagrid').datagrid({  
				pageNumber : 1,    
				url : 'toCustomerService'        
			});     
			$("#CusSerAddLog").datagrid("reload");
    	}});     
    	
    	$("#CusSer_moreDelete").linkbutton({onClick:function(){
    		alert(1);
    		var selRow=$("#CusSerDagrid").datagrid("getSelections");    
    		if(selRow.length==0){        
    			alert("请至少选择一行数据！");    
    			return false;
    		}
    		$.messager.confirm("确认","确定要删除所有所选记录？",function(isDelete){
    			if(isDelete){
    				var strIds="";
    				for(var i=0;i<selRow.length;i++){
    					strIds+=selRow[i].crId+",";
    				}  
    				//循环切割
    				strIds=strIds.substr(0,strIds.length-1);    
    				alert("输出："+strIds);  
    				 $.getJSON("deleteMoreData",{strIds:strIds},function(obj){
    					 if(obj=='"success"'){                           
    			    		 $.messager.alert("提示","删除成功！");
    			    	 }else{
        				     $.messager.alert("提示信息","删除失败！",'warning');
        				 }     
    					 $('#CusSerDagrid').datagrid('reload');
    				 }) 
    				
    				   
    			}
    		})
    		
    	}});
    });
    
    $(function(){
		   $("#CusSer_aOne").linkbutton({onClick:function(){   
				 alert($('#CusSerAddLog').dialog('options').href2);    
					  $("#CusSer_form_data").form({       
						url: $('#CusSerAddLog').dialog('options').href2,
						method:"post",                 
						onSubmit:function(params){ 
						      
							return $(this).form('validate');    
						},  
						success:function(v){
							alert(v);    
							var data='"success"';     
							if(v==data){  
								alert("操作成功");  
							}else{  
								alert("操作失败");  
							}
							$("#CusSerAddLog").window("close");  
							$('#CusSerDagrid').datagrid('reload');              
						}
					}).submit();      
				}});
	   });  
    
    var num=1;
    var num2=1;
    var num3=1;
    $(function(){
    	
        $("#CusSer_ContainT").focus(function(){ 
     		 if(num==1){          
     			$(this).animate({height:"55"}) ;       
     			num==2;    
     		 }   
     	 }); 
        $("#CusSer_khfkT").focus(function(){
        	if(num2==1){
        		$(this).animate({height:'55'});
        		num2==2;
        	}
        });
        $("#CusSer_rebackT").focus(function(){
        	if(num3==1){
        		$(this).animate({height:'55'});
        		num3==2; 
        	}
        });
    });  

	$(function(){
		$("#CusSerDagrid").datagrid({
			fit:true,
			border:false,
			fitColumns:true, 
			url:'findAllcustomerService',
			toolbar:'#CusSer_tb',    
			method:'post',
			pagination:true,columns:[[
			   {field:'cc',width:1,checkbox:true},
			   {field:'crId',width:1,title:'ID'},
			   {field:'crTheme',width:1,title:'主题'},
			   {field:'customerName',width:1,title:'对应客户'},
			   {field:'serviceContain',width:1,title:'服务类型'}, 
			   {field:'serviceWayContain',width:1,title:'服务方式'},
			   {field:'crStartDatetime',width:2,title:'开始日期',
				   formatter:function(value,row,index){    
			            if(value){ 
			            var date = new Date(value); 
			            var month = date.getMonth() + 1; 
			            var day = date.getDate(); 
			            if(month<10){ 
			            month='0'+month; 
			            }    
			            if(day<10){ 
			            day='0'+day;    
			            } 
			            return date.getFullYear() + '年' + month + '月'+ day+'日'; 
			            } 
			            }},       
			   {field:'crExcute',width:1,title:'执行人'},
			   {field:'dealContain',width:1,title:'花费时间'},
			   {field:'crState',width:1,title:'状态'},
			   {field:'bb',width:2,title:'操作',formatter:function(value,row,index){
				   var btn='<a class="llj-CusSer-edit" onclick="editCustomrServer('+row.crId+')" href="javascript:void(0)" class="easyui-linkbutton"></a>';
			       var btn2='<a class="llj-CusSer-delete" onclick="deleteCustomrServer('+row.crId+')" href="javascript:void(0)" class="easyui-linkbutton"></a>';
			       var btn3='<a class="llj-CusSer-view" onclick="ViewCustomrServer('+row.crId+')" href="javadcript:void(0)" class="easyui-linkbutton"></a>';
			       return btn+btn2+btn3;         
			   }}          
            ]], 
            onLoadSuccess:function(data){
            	$(".llj-CusSer-edit").linkbutton({text:'编辑',plain:true,iconCls:'icon-edit'});  
            	$(".llj-CusSer-delete").linkbutton({text:'删除',plain:true,iconCls:'icon-zj-delete'}); 
            	$(".llj-CusSer-view").linkbutton({text:'视图',plain:true,iconCls:'icon-orderinfo'});  
            	   
            }      
		})  
	});
</script>       

  <table id="CusSerDagrid" class="easyui-datagrid"></table>
  
  <div id="CusSer_tb">
		<a><input
			class="easyui-searchbox"
			data-options="width:200,prompt:'客户服务主题',       
			searcher:function(value,name){
				//修改datagrid的url
				$('#CusSerDagrid').datagrid({pageNumber:1, url: ''});     
				//重新加载数据             
				$('#CusSerDagrid').datagrid('load', {key:value});                        
			}">
		</a>          
			  
		<a id="CusSer_Add" href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">添加</a>
		<a id="CusSer__refresh_list_all" href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true">刷新</a>
        <a id="CusSer_moreDelete" class="easyui-linkbutton" data-options="iconCls:'icon-cut',plain:true">批量删除</a>
 </div> 
  
  
  
   
   <div id="CusSerAddLog" class="easyui-dialog" style="width: 500px; height:auto; padding: 10px;" data-options="iconCls:'icon-add',resizable:true,modal:true,closed:true" >      
     
   <div class="CusSerLayoutDiv" class="easyui-layout" data-options="fit:true" style="border:solid 1px none">
      <form method="post" id="CusSer_form_data">       
	      <div id="CusSer_centerDiv" data-options="region:'center'" style="padding:10px,border:solid 1px pink">    
	         <div class="CusSer_sameThere">
	              <input type="text" name="crId" id="CusSer_deleverId" style="display:none">    
	              <input name="crTheme" class="easyui-textbox" data-options="label:'主题:',labelPosition:'left',labelWidth:41,width:400,required:true">                                   
             </div>                               
             <div id="CusSer_div_kh">
                <input type="text" name="customerId" id="CusSer_custorId" style="display:none">   
        	    <input name="customerName" class="easyui-textbox" data-options="label:'对应客户:',labelPosition: 'left',labelWidth:65,width:400,required:true" >           
             </div>  
             <div class="CusSer_same" id="CusSer_div_pyt">
                 <input class="easyui-textbox" id="CusSer_pytANDgjz" data-options="prompt:'拼音头.编号.关键字',width:150"> 
        		 <a id="CusSer_SearchCust" class="easyui-linkbutton" data-options="iconCls:'icon-search'"></a>  
        		 <a id="CusSer_viewCust" class="easyui-linkbutton" data-options="iconCls:'icon-search'"></a>  
             </div>   
             <div class="CusSer_same" id="CusSer_type">    
	              <span>服务类型:&nbsp;</span>
	              <input id="CusSer_rdo1" name="serviceId" type="radio" value="6" name="">答疑
	              <input id="CusSer_rdo1" name="serviceId" type="radio" value="7">故障排除
	              <input id="CusSer_rdo1" name="serviceId" type="radio" value="8">培训
	              <input id="CusSer_rdo1" name="serviceId" type="radio" value="9">升级 
	              <input id="CusSer_rdo1" name="serviceId" type="radio" value="10">其他      
             </div>                       
             <div id="CusSer_Way">  
                  <span>服务方式:&nbsp;</span> 
	              <input id="CusSer_rdo1" name="serviceWayId" type="radio" value="1">电话
	              <input id="CusSer_rdo1" name="serviceWayId" type="radio" value="2">传真
	              <input id="CusSer_rdo1" name="serviceWayId" type="radio" value="3">邮寄
	              <input id="CusSer_rdo1" name="serviceWayId" type="radio" value="4">上门   
	              <input id="CusSer_rdo1" name="serviceWayId" type="radio" value="5">其他       
             </div> 
             <div class="CusSer_same" id="CusSer_Time">      
	              <div id="CusSer_date">
		              <input name="crStartDatetime" type="text" class="easyui-datebox" requinone ="requinone" data-options="label:'开始日期:',labelWidth:64,width:200,required:true"></input>   
	              </div>
             </div>   
             <div class="CusSer_same" id="CusSer_costTime">   
	              <span>花费时间:&nbsp;&nbsp;&nbsp;</span>   
	              <div class="CusSer_usertime"><input name="dealContain" class="easyui-combobox" data-options="width:200,panelHeight:'auto',
	              		valueField:'dealId',textField:'dealContain',url:'searchComplainDealTime',required:true,editable:false"> 
	              </div>                         
             </div>               
             <div class="CusSer_same" id="CusSer_divlinkman">    
                  <input type="text" name="contId" id="CusSer_contId" style="display:none">  
	              <span>联系人:&nbsp;&nbsp;&nbsp;</span>            
	              <div class="CusSer_linkmanDiv"><input name="contLinkMan" class="easyui-textbox" data-options="width:200,panelHeight:'auto'
	                   ,textField:'contLinkMan',required:true">      
	              </div>                       
             </div>  
             <div id="CusSer_state">
                  <span>状态:&nbsp;</span>   
	              <input id="CusSer_rdo2" name="crState" type="radio" value="无需处理">无需处理
	              <input id="CusSer_rdo2" name="crState" type="radio" value="未处理">未处理
	              <input id="CusSer_rdo2" name="crState" type="radio" value="处理中">处理中
	              <input id="CusSer_rdo2" name="crState" type="radio" value="处理完成">处理完成       
             </div><br/>          
             <div id="CusSer_divExcute">  
                  <input name="crExcute" class="easyui-textbox" data-options="label:'执行人:',
        	      labelPosition: 'left',labelWidth:53,width:180">              
             </div>                       
             <div class="CusSer_same">  
	              <div id="CusSer_divfwnr">服务内容:</div>                       
	              <div id="CusSer_serviseContain"><textarea name="crContain" class="CusSer_serviseContain" id="CusSer_ContainT" rows="1" cols="50"></textarea></div>
             </div>     
             <div class="CusSer_same">  
	              <div id="CusSer_divkhfk">客户反馈:</div>                    
	              <div id="CusSer_serviseContain"><textarea name="crFeedback" class="CusSer_serviseContain" id="CusSer_khfkT" rows="1" cols="50"></textarea></div>
             </div> 
             <div class="CusSer_same">                                                       
	              <div id="CusSer_divReback">备注:</div>                     
	              <div id="CusSer_serviseContain"><textarea name="crRemarks" class="CusSer_serviseContain" id="CusSer_rebackT" rows="1" cols="50"></textarea></div>
             </div>                            
	      </div><br/>	    
	      <div data-options="region:'south'" style="border:solid 1px none">
	          <a id="CusSer_aOne" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true">提交</a>        
	          <a class="easyui-linkbutton" data-opions="iconCls:'icon-cancel',plain:true" href='javascript:void(0)'onclick="javascript:$('#CusSerAddLog').window('close')">取消</a>      
          </div>   
      </form>        
   </div>       
</div>
            
</body>   
</html>